package com.ruoyi.xh.service.impl;

import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.xh.mapper.XhCarMapper;
import com.ruoyi.xh.domain.XhCar;
import com.ruoyi.xh.service.IXhCarService;

/**
 * 用户购物车Service业务层处理
 * 
 * @author songjw
 * @date 2024-12-13
 */
@Service
public class XhCarServiceImpl extends ServiceImpl<XhCarMapper,XhCar> implements IXhCarService {

    /**
     * 查询用户购物车
     * 
     * @param id 用户购物车主键
     * @return 用户购物车
     */
    @Override
    public XhCar selectXhCarById(Long id)
    {
        return this.getById(id);
    }

    /**
     * 查询用户购物车列表
     * 
     * @param xhCar 用户购物车
     * @return 用户购物车
     */
    @Override
    public Page<XhCar> selectXhCarList(XhCar xhCar)
    {
        return new Page<>();
    }

    /**
     * 新增用户购物车
     * 
     * @param xhCar 用户购物车
     *
     */
    @Override
    public void insertXhCar(XhCar xhCar)
    {
        this.save(xhCar);
    }

    /**
     * 修改用户购物车
     * 
     * @param xhCar 用户购物车
     *
     */
    @Override
    public void updateXhCar(XhCar xhCar)
    {
        this.updateById(xhCar);
    }

    /**
     * 批量删除用户购物车
     * 
     * @param ids 需要删除的用户购物车主键
     *
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteXhCarByIds(Long[] ids)
    {
        this.removeByIds(Stream.of(ids).collect(Collectors.toSet()));
    }
}
